package com.qf.bank.common.utils;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.ShearCaptcha;
import cn.hutool.captcha.generator.RandomGenerator;
import com.qf.bank.common.bo.CaptchaBO;

/**
 * @author 惠佳旭
 * @date 2019/12/5
 */
public class CaptchaUtils {

  public static CaptchaBO getCaptcha() {
    ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 50, 5, 5);
    captcha.setGenerator(new RandomGenerator("abcdefghjkmnpqrstuvwxyz23456789", 4));
    CaptchaBO captchaBO = new CaptchaBO();
    captchaBO.setImg(captcha.getImageBytes());
    captchaBO.setCode(captcha.getCode());
    return captchaBO;
  }
}
